<!doctype html>
<html style="height:100%">
<head>
<meta charset="utf-8">
<meta name="viewport" content="height=device-height,width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"/>
<title>确认支付</title>
<link href="<{$ipath}>api/style/wxpay.css" type="text/css" rel="stylesheet">
<script src="<{$ipath}>public/js/jquery.js"></script>
<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script type="text/javascript">
	function onBridgeReady(){
	   WeixinJSBridge.invoke(
		   'getBrandWCPayRequest',{
			   'appId':'<{$jsdata.appId}>',
			   "timeStamp":"<{$jsdata.timeStamp}>",
			   "nonceStr":"<{$jsdata.nonceStr}>",
			   "package":"<{$jsdata.package}>",
			   "signType":"MD5",
			   "paySign":"<{$jsdata.paySign}>"
		   },
		   function(res){
			   if(res.err_msg == "get_brand_wcpay_request:ok" ) {
				    window.location.href='<{$url}>';
				   	//showdiv('订单支付成功')
					//$("#publicbutton").removeAttr("onclick");
					//$("#publicbutton").attr("href","<{$url}>");
				}else if(res.err_msg == "get_brand_wcpay_request:cancel"){
					showdiv('支付被取消 订单未完成');
				}else{
					showdiv('支付失败:'.res.err_msg);
					return false; 
				}
		   }
	   ); 
	}
	function callpay(){
		if (typeof WeixinJSBridge == "undefined"){
		   if( document.addEventListener ){
			   document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
		   }else if (document.attachEvent){
			   document.attachEvent('WeixinJSBridgeReady', onBridgeReady); 
			   document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
		   }
		}else{
		   onBridgeReady();
		} 
	} 
	function closediv(){
		$("#shard").hide();
		$("#publicdiv").hide();
	}
	function showdiv(str){
		$("#publicdiv #showhtml").html(str);
		$("#shard").show();
		$("#publicbutton").attr("onclick","closediv()");
		$("#publicdiv").show();
	}
	</script>
</head>

<body style="height:100%">
<div class="bigbox">
   	  <div class="confirm_pay">
            <div class="paybox">
                <div class="pay01">
                    <span class="pay_span01">支付方式</span>
                    <p class="pay_p02">微信支付</p>
                </div>
            </div>
            <div class="paybox">
                <div class="pay01">
                    <span class="pay_span01">支付对象</span>
                    <p class="pay_p02"><{$title}></p>
                </div>
            </div>
            <div class="paybox">
                <div class="pay01">
                    <span class="pay_span01">支付金额</span>
                    <p class="pay_p02 orange">￥<{$price}></p>
                </div>
            </div>
            <div class="paybox">
                <div class="pay01">
                    <span class="pay_span01">收款方</span>
                    <p class="pay_p02"><{$shopname}></p>
                </div>
            </div>
            
        </div>
        <div class="next pay_button">
                <p class="button03 dian" id="next01" onClick="callpay()">立即支付</p>
        </div>
</div>
<div id="shard"></div>
<div id="publicdiv">
<ul id="showhtml"></ul>
<a id="publicbutton">确定</a>
</div>
</body>
</html>
